<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/settingForecast.do"/>

<%@ page import="com.scalar.chiptrack.users.User,
                 com.scalar.chiptrack.users.UserGroup,
                 java.util.Calendar,
                 com.scalar.chiptrack.utils.ConfigManager"%>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js">
</script>
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</script>
<SCRIPT language="JavaScript">

    function submitPage()
    {
        var productId = document.fcblForm.product.value;
        var customerId = document.fcblForm.customer.value;
        var monthId    = document.fcblForm.startMonth.value;
        var yearId     = document.fcblForm.year.value;
        var month_count = document.fcblForm.monthCount;
        var errors = '';

        /*

        if (productId == '-1')
        {
            errors = 'Please select the product';
        }

        if (customerId == '-1')
        {
            errors = errors + '<br>' + 'Please select the customer';
        }

        */

        if (monthId == '-1')
        {
            errors = errors + '<br>' + '<li> Please select the Start Month';
        }
        if (yearId == '-1')
        {
            errors = errors + '<br>' + '<li> Please select the Year';
        }
        if( month_count.value < '1')
        {
            errors = errors +'<br>' + "<li>  Please enter Valid value in Show next months";
            month_count.select();
        }
        else if( !isInteger( month_count.value ) )
        {
             errors = errors +'<br>' + "<li>  Please enter a valid Months";
             month_count.select();
        }
        if(errors != '')
        {
            pa=document.getElementById("font1");
            pa.innerHTML = errors;
            return;
        }

        document.fcblForm.prompt0.value = document.fcblForm.customer.value;
        document.fcblForm.prompt1.value = document.fcblForm.product.value;
        document.fcblForm.prompt2.value = document.fcblForm.startMonth.value;
        //document.fcblForm.prompt3.value = parseInt(document.fcblForm.startMonth.value) + parseInt(document.fcblForm.monthCount.value);
        document.fcblForm.prompt3.value = parseInt(document.fcblForm.monthCount.value);
        document.fcblForm.prompt4.value = document.fcblForm.year.value;
        document.fcblForm.prompt5.value = 0;

        // Added by Gandhi on 18th Aug 2004 to send defaultPrompt as parameter to sp_fc_bl_shipped_report()
        var pa = document.getElementById("errors");
		var d = new Date();
		var day = d.getDate();
		var month = d.getMonth()+1;
		var year = d.getFullYear();
		var hour = d.getHours();
		var min = d.getMinutes();
		var sec = d.getSeconds();
		var today = month+"/"+day+"/"+year;
        var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;
        document.fcblForm.prompt6.value = defaultPrompt;
        // Ends here - Gandhi

        document.fcblForm.action = "<%=chipTracContext%>/jsp/report.jsp?nameReport=Marketing/Forecast/Forecast_Backlog_Shipped.rpt";
        document.fcblForm.submit();
    }

</SCRIPT>

<!-- Top Header Start-->

<%@ include file="/jsp/includes/header.jsp" %>

<!-- Top Header End-->

<%
    Calendar today = Calendar.getInstance();
    String year = today.get( Calendar.YEAR )+"";
    String month = today.get( Calendar.MONTH ) +"";

%>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->

    <%@ include file="/jsp/marketing/marketing_report_menu.jsp" %>

    </TD>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>

<!-- from here your body starts -->
<form name="fcblForm" method="post">

<input type="hidden" name="prompt0">
<input type="hidden" name="prompt1">
<input type="hidden" name="prompt2">
<input type="hidden" name="prompt3">
<input type="hidden" name="prompt4">
<input type="hidden" name="prompt5">
<input type="hidden" name="prompt6">

<table border=0 cellspacing=0 cellpadding=4 width='98%' align=right class="NArialL">
    
    <tr><td colspan=5 class="NArialW" align='center'> Forecast Vs. Backlog Vs. Shipped Report </TD></TR>
    
    <tr><td colspan=5><BR></td></tr>
    <tr><td colspan=5><FONT id='font1' color='#FF0000'></td></tr>
    <tr><td colspan=5><BR></td></tr>

    <tr>
        <td width="15%"> Customer: </td>
        <td width="20%"> 
        
            <select name="customer" class="txfield">
            
                <option value="0">-- Select Customer --</option>
                <option value="0"></option>
             
                <logic:iterate id="customerList" name="customerList">
                   <logic:notEqual name="customerList" value="null">
                       <option value="<bean:write name="customerList" property="value"/>">
                           <bean:write name="customerList" property="label"/>
                       </option>
                   </logic:notEqual>
                </logic:iterate> 
                
            </select>

        </td>

        <td width="5%">&nbsp;</td>

        <td width="15%"> Product: </td>
        
        <td >
            <select name="product" class="txfield">
            
                <option value="0">-- Select Product --</option>
                <option value="0"></option>
             
                <logic:iterate id="productList" name="productList">
                   <logic:notEqual name="productList" value="null">
                       <option value ="<bean:write name="productList" property="value"/>">
                           <bean:write name="productList" property="label"/>
                       </option>
                   </logic:notEqual>
                </logic:iterate> 
                
            </select>            
            
        </td>

    </tr>
    
    <tr>
        <td width="15%"> Start Month: </td>

        <td width="20%">
        
            <select name="startMonth" class="txfield" >

                <option value="-1">-- Select Start Month --</option>
                <option value="-1"></option>

                <logic:iterate id="monthList" name="monthList" >
                   <logic:notEqual name="monthList" value="null">
                       <option value = <bean:write name="monthList" property="value"/>
                       <logic:equal name="monthList" property="value" value="<%=month%>">selected="true"</logic:equal>>
                           <bean:write name="monthList" property="label"/>
                       </option>
                   </logic:notEqual>
                </logic:iterate>

            </select>
        </td>

        <td width="5%">&nbsp;</td>

        <td width="15%"> Year: </td>
       <td >
       <!-- Modified by Gandhi on 26th Aug to set curent year as selected year -->
           <select name="year" class="txfield" >

                <option value="-1">-- Select --</option>
                  <logic:iterate id="years" name="years" >
                   <logic:notEqual name="years" value="null">
                       <option value = <bean:write name="years" property="value"/>
                       <logic:match name="years" property="value" value="<%=year%>">selected="true"</logic:match>>
                           <bean:write name="years" property="label"/>
                       </option>
                   </logic:notEqual>
                </logic:iterate>

            </select>
      <!-- Ends here - Gandhi -->
        </td>

    </tr>

    <tr>
        <td width="15%"> Show next: </td>
        <td width="20%">
            <input type=text name="monthCount" value="6" maxlength="2" size="2" class="txfield" > months
        </td>
        <td width="5%">&nbsp;</td>
        <td colspan=2>
            &nbsp;
        </td>
    </tr>

    <tr><td colspan=5 align="center">
        <A href="javascript:submitPage();"><IMG src="<%=chipTracContext%>/jsp/includes/images/submit.gif" border='0' onmouseover="window.status='Click to Generate Forecast Vs. Backlog & Shipped Report';return true" onmouseout="window.status='';return true" title="Click here to Generate Forecast Vs. Backlog & Shipped Report"></A>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <A href="javascript:document.fcblForm.reset();"><IMG src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0'onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></A>
    </td></tr>
    
    <tr><td colspan=5><br><br></td></tr>

</Table>

</form>


<!-- till here -->

<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->

<%@ include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->

</BODY>
</HTML>
